/*!
 * \file HandleGuard.h
 * \date 2015/11/07 19:55
 *
 * \author Weizehua
 * Contact: 475647575@qq.com
 *
 * \brief Guard for a Windows Handle
 *
 * TODO: long description
 *
 * \note
*/

#pragma once
#ifndef HandleGuard_h__
#define HandleGuard_h__

#include <wtypes.h>

namespace GenericFilter
{
    namespace Process
    {
        class HandleGuard
        {
        public:
            HandleGuard(HANDLE handle);
            ~HandleGuard();
        public:
            inline HANDLE get();
            inline HANDLE release();

        public:
            inline operator HANDLE ()
            {
                return handle;
            }
        private:
            HANDLE handle = INVALID_HANDLE_VALUE;
        };
    }
}
#endif // HandleGuard_h__